<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<!--<![endif]-->
<!-- BEGIN HEAD -->
<!-- BEGIN BODY -->
<style>
.radio-inline{
	padding: 0;
}
.col-sm-4 .radio-list .tuning{
	margin-left: 48px;
}
.col-sm-4 .radio-list .tuning-run{
	margin-left: 34px;
}
.wraping{
	background: #fff;
}
.table_btn_box{
		margin-bottom: 5px;
		float: left;
	}
.btn-div{
		float: left;top: 10px;margin-bottom: 5px;padding-left: 10px;
	}
	.modal-content .modal-footer button.btn-primary,.modal-content .modal-footer button.btn-danger{
		margin-bottom: 0;
		margin-top:0;
	}
	.modal-body .form-group .table_btn_box a.blue{
		margin-right:15px;}
		table.table thead .sorting_asc{
			background: none;
		}
		.row{
			margin: 0;
		}
</style>
<body class="page-header-fixed">

			<div class="btn-div">

				<a class="btn blue" href="javascript:;"  data-target="#splitratioSchemeModel" 
					data-toggle="modal" ng-click="addCommonSplitratioScheme();">
					<i class="fa fa-plus"></i>
						新增通配规则
				</a>
				<a class="btn blue" href="javascript:;"  data-target="#splitratioSchemeModel" 
					data-toggle="modal" ng-click="addSpecificSplitratioScheme();">
					<i class="fa fa-plus"></i>
						新增特定规则
				</a>
			</div>
			<table class="table table-striped table-bordered table-hover" id="table_1">
			<thead>
				<tr>
					<th>分成方案号</th>
					<th>分成方案名</th>
					<th>所属服务</th>
					<th>是否通配规则</th>
					<th>是否启用</th>	
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class="odd gradeX" ng-repeat="splitratioScheme in splitratioSchemeList  track by $index" pg-loaded="{{$last}}" target-table="table_1">
					<td>
						<span ng-bind="splitratioScheme.scheme_no"></span>
					</td>
					<td>
						<span ng-bind="splitratioScheme.scheme_name | commonSubString"></span>
					</td>
					<td>
                    	<span ng-bind="splitratioScheme.service_no | getValueInStaticFilter:'orderServiceArray'"></span>
                    </td>
                    <td>
                    	<span ng-bind="splitratioScheme.entity_id | getValueInStaticFilter:'whetherArray'"></span>
                    </td>
                    <td>
                    	<span ng-bind="splitratioScheme.valid_flag | getValueInStaticFilter:'validArray'"></span>
                    </td>
					<td>
						<a class="btn" href="javascript:;"  data-target="#splitratioSchemeModel" 
						data-toggle="modal" ng-click="updateSplitratioScheme(splitratioScheme);">
							修改
						</a>
						<a class="btn" href="javascript:;"  data-target="#allotChargerManage" 
						data-toggle="modal" ng-click="allotChargerManage(splitratioScheme);" ng-if="splitratioScheme.valid_flag == 1">
							绑定电桩管理
						</a>
					</td>
				</tr>
			</tbody>
			</table>
			<tm-pagination conf="paginationConf"></tm-pagination>
			<div id="splitratioSchemeModel" class="modal fade" role="dialog" aria-hidden="true" data-backdrop="false">
				<div class="modal-dialog" style="width:1000px">
					<div class="modal-content">
						<form class="w5c-form demo-form" role="form" w5c-form-validate="vm.validateOptions" novalidate name="validateForm">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true" ng-click="validateForm.reset()">×</button>
							<h4 class="modal-title" ng-if="'specific'==schemeType">特定规则分成方案新增/修改</h4>
							<h4 class="modal-title" ng-if="'common'==schemeType">通配规则分成方案新增/修改</h4>
						</div>
						<div class="modal-body form">
							<div class="form-group">
								<div class="row" ng-if="'insert'!=modifyType">
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>是否启用</label>
										<div class="col-sm-4 radio-list paddingTop">
												<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px">
													<input ng-model="selectedSS.valid_flag" type="radio"  value="1"
														   ng-selected="selectedSS.valid_flag==1">
													启用
												</label>
												<label  class="radio-inline col-md-4" style="margin:0px;padding: 0px">
													<input ng-model="selectedSS.valid_flag" type="radio"  value="0"
														   ng-selected="selectedSS.valid_flag==0">
													停用
												</label>
											</div>
								</div>
								<div class="row">
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>方案名</label>
										<div class="col-sm-4">
											<div class="input-group">
												<input type="text" class="form-control" ng-model="selectedSS.scheme_name" required="" 
												name="scheme_name"  ng-maxlength="64" placeholder="不要超过64个字节"/>
											</div>
									</div>
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>绑定服务</label>
									<div class="col-sm-4">
										<div class="input-group">
											<select class="form-control" ng-model="selectedSS.service_no" ng-disabled="'specific'!=schemeType"
											required="" name="service_no">
												<option value="">请选择须绑定服务</option>
												<option value="100001">充电服务</option>
												<option value="100002">代收电费服务</option>
												<option value="100003">充电预约服务</option>
											</select>
										</div>
									</div>
								</div>
								<hr />
								<div ng-repeat="entity in entityList track by $index">

								<div class="row">
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>归属类型</label>
									<div class="col-sm-4 paddingTop">
										<div class="radio-list">
											<label class="radio-inline ">
												<input ng-model="entity.entity_type" type="radio"  value="1" ng-disabled="'specific'!=schemeType"
												ng-selected="entity.entity_type==1">
													运营商
											</label>
											<label class="radio-inline tuning"style="margin: 0">
												<input ng-model="entity.entity_type" type="radio"  value="4"	ng-disabled="'specific'!=schemeType"
												ng-selected="entity.entity_type==4">
													合作商
											</label>
										</div>
									</div>
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>归属对象</label>
									<div class="col-sm-4">
										<div class="input-group" ng-if="'specific'==schemeType">
											<select class="form-control" 
											ng-if="!!entity.entity_type&&entity.entity_type==1"
											ng-options="operMechant.oper_merchant_id as operMechant.oper_name for operMechant in operMechantList "  
											ng-model="entity.entity_id"  id="selectEntity_{{$index}}">
											<option value="">请选择运营商</option>
											</select>
											<select class="form-control" 
											ng-if="!!entity.entity_type&&entity.entity_type==4"
											ng-options="merchant.merchant_id as merchant.name for merchant in merchantList " 
											ng-model="entity.entity_id" id="selectEntity_{{$index}}">
											<option value="">请选择合作商</option>
											</select>
										</div>
										<div class="input-group" ng-if="'common'==schemeType">
											<input type="text" class="form-control" ng-model="entity.entity_id" ng-readonly="true"/>
										</div>
									</div>
								</div>
								<div class="row">
									<label class="col-sm-2 control-label text-right"><span class="star-color">* </span>分成比例</label>
									<div class="col-sm-4">
										<div class="input-group">
											<input type="text" class="form-control" ng-model="entity.ratios" required="" name="ratios" w5c-dynamic-element/>
										</div>
									</div>
									<label class="col-sm-2 control-label text-right">保底金额(元)</label>
									<div class="col-sm-4">
										<div class="input-group">
											<input type="text" class="form-control" ng-model="entity.min_amount" ng-readonly="true"/>
										</div>
									</div>
								</div>
									<div class="row" style="text-align: right;margin-right: 15px">
										<button type="button" class="btn btn-danger" ng-click="removeSplitratio($index);" ng-if="'specific'==schemeType"><i class="fa fa-times"></i>删除</button>
									</div>
									<hr />
								</div>
	


								
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-primary" ng-click="addSplitratio();" ng-if="'specific'==schemeType"><i class="fa fa-check" style="margin-top:0;" ng-if="'specific'==schemeType"></i>添加分成合作商</button>
							<button type="button" class="btn btn-danger" data-dismiss="modal" style="margin-top:0;" ng-click="validateForm.reset()"><i class="fa fa-times"></i>关闭</button>
							<button type="button" class="btn btn-primary" w5c-form-submit="modifySplitratio();" style="margin-top:0;"><i class="fa fa-check"></i>保存</button>
						</div>
						</form>
					</div>
				</div>
			</div>
			<div id="allotChargerManage" class="modal fade" role="dialog" aria-hidden="true" data-backdrop="false" >
				<div class="modal-dialog" style="width:1000px">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal"
								aria-hidden="true">×</button>
							<h4 class="modal-title">分成【{{selectedSS.scheme_name}}】分配电桩管理</h4>
						</div>

						<div class="modal-body form">

							<div class="form-group">
								<div class="table_btn_box">
									<a class="btn blue" href="javascript:;" ng-click="changeCharerList('alloted');">
										显示已分配电桩
									</a>
									<a class="btn blue" href="javascript:;" ng-click="changeCharerList('unAllot');">
										显示可分配电桩
									</a>
									<a class="btn blue abnormal" href="javascript:;"  ng-click="relevanceCharger();" ng-if="relevanceFlag=='unAllot'">
										绑定
									</a>
									<a class="btn blue u_abnormal" href="javascript:;" ng-click="relevanceCharger();" ng-if="relevanceFlag=='alloted'">
										解绑
									</a>
								</div>
								<table class="table table-striped table-bordered table-hover"
									id="table_2">
									<thead>
										<tr>
											<th class="table-checkbox">
												<input type="checkbox" class="checkbox_table" />
											</th>
											<th>桩ID</th>
											<th>站点名称</th>
											<th>运营二维码</th>
										</tr>
									</thead>
									<tbody>
										<tr class="odd gradeX"
											ng-repeat="charger in chargerList  track by $index"
											on-loaded="{{$last}}" target-table="table_2">
											<td>
												<input type="checkbox" class="checkboxes" value="{{charger.charger_id}}" name="chargerRowModel"/>
											</td>
											<td>
												<span ng-bind="charger.charger_id"></span>
											</td>
											<td>
												<span ng-bind="charger.station_name | commonSubString"></span>
											</td>
											<td>
												<span ng-bind="charger.qr_code"></span>
											</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-danger" data-dismiss="modal">
								<i class="fa fa-times"></i>关闭
							</button>
						</div>
					</div>
				</div>
			</div>
</body>
</html>
